package com.sky.controller.user;

import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController("userCategory")
@RequestMapping("/user/category")
@Api("用户分类功能")
@Slf4j
public class CategoryController {
    @Autowired
    private CategoryService categoryService;


    /**
     * @return Result<List < Category>>
     * @throws
     * @description 用户根据类型查询分类的功能
     * @author Administrator
     * @param[1] Type
     * @time 2023/12/1 16:10
     */
    @ApiOperation("用户根据类型查询分类的功能")
    @GetMapping("/list")
    public Result<List<Category>> selectCategoryByType(Integer Type) {

        log.info("正在执行用户端根据类型查询分类的功能.....类型为:{}", Type);

        List<Category> categories = categoryService.byTypeSelectCategory(Type);
        return Result.success(categories);

    }


}
